import { phoneValidate } from '@/utils/validate'
const commonForm = [
  {
    type: 'input',
    label: '推荐人手机号',
    key: 'laborNumber',
    labelWidth: '220rpx',
    maxLength: 11
  },
  {
    type: 'select',
    label: '用户类型',
    key: 'identity',
    isDisabled: true,
    options: [
      { text: '个人用户', value: 1 },
      { text: '制作团队', value: 2 },
      { text: '宣推团队', value: 3 },
      { text: '厂牌入驻', value: 4 }
    ],
    rules: [
      { required: true, errorMessage: '请选择用户类型' }
    ]
  }
]
const cardForm = [
  {
    type: 'select',
    label: '证件类型',
    key: 'paperType',
    options: [
      { text: '身份证', value: '1' },
      { text: '香港身份证', value: '2' },
      { text: '台湾身份证', value: '3' },
      { text: '澳门身份证', value: '4' },
      { text: '护照', value: '5' }
    ],
    rules: [
      { required: true, errorMessage: '请选择证件类型' }
    ]
  },
  {
    type: 'input',
    label: '证件号码1',
    key: 'paperNumber1',
    hiddenItem: true,
    rules: [
      { required: true, errorMessage: '请填写证件号码' }
    ]
  },
  {
    type: 'input',
    label: '证件号码2',
    key: 'paperNumber2',
    hiddenItem: true,
    rules: [
      { required: true, errorMessage: '请填写证件号码' }
    ]
  },
  {
    type: 'input',
    label: '证件号码3',
    key: 'paperNumber3',
    hiddenItem: true,
    rules: [
      { required: true, errorMessage: '请填写证件号码' }
    ]
  },
  {
    type: 'input',
    label: '证件号码4',
    key: 'paperNumber4',
    hiddenItem: true,
    rules: [
      { required: true, errorMessage: '请填写证件号码' }
    ]
  },
  {
    type: 'input',
    label: '证件号码5',
    key: 'paperNumber5',
    hiddenItem: true,
    rules: [
      { required: true, errorMessage: '请填写证件号码' }
    ]
  }
]
const areaForm = [
  {
    type: 'switch',
    label: '是否为海外地区',
    key: 'isOverSea',
    labelWidth: '240rpx',
    initVal: '1',
    activeValue: '2',
    inactiveValue: '1'
  },
  {
    type: 'picker',
    label: '所在地区',
    key: 'areaCodeList',
    labelKey:'cityList',
    urlOptions: {
      requestName: 'countryList',
      dataLocal: 'data',
      keys: {
        text: 'name',
        value: 'code'
      }
    },
    rules: [
      { required: true, errorMessage: '请选择地区' }
    ]
  },
  {
    type: 'select',
    label: '所在地区',
    key: 'seaAreaCode',
    labelKey:'seaCity',
    placeholder: '请选择地区',
    hiddenItem: true,
    urlOptions: {
      requestName: 'overSeaCountryList',
      dataLocal: 'overlist',
      keys: {
        text: 'name',
        value: 'id'
      }
    },
    rules: [
      { required: true, errorMessage: '请选择所在地区' }
    ]
  }
]
export const FORM_CONFIG = [
  ...commonForm,
  {
    type: 'radioGroup',
    label: '性别',
    key: 'sex',
    initVal: 1,
    options: [
      { text: '男', value: 1 },
      { text: '女', value: 2 },
      { text: '未知', value: 3 }
    ],
    rules: [
      { required: true, errorMessage: '请选择性别' }
    ]
  },
  ...areaForm
]

export const REAL_FORM_CONFIG = [
  {
    type: 'input',
    label: '真实姓名',
    key: 'realName',
    rules: [
      { required: true, errorMessage: '请填写真实姓名' }
    ]
  },
  ...cardForm,
  {
    type: 'radioGroup',
    label: '身份标签',
    key: 'identityLabel',
    initVal: 1,
    urlOptions: {
      requestName: 'fetchIdentity',
      keys: {
        text: 'identityLabel',
        value: 'id'
      }
    },
    rules: [
      { required: true, errorMessage: '请选择身份标签' }
    ]
  }
]

export const OTHER_FORM_CONFIG = [
  {
    type: 'imgUpload',
    label: '上传站外截图',
    key: 'outsideImg'
  },
  {
    type: 'imgUpload',
    label: '上传名片',
    key: 'namecard'
  },
  {
    type: 'topSlot',
    label: '主页链接',
    key: 'homepageLinkList',
    slotName: 'linkSlot',
    isLabelSlot: true,
    labelSlot: 'linkBtn'
  }
]

export const GROUP_FORM_CONFIG = [
  ...commonForm,
  {
    type: 'input',
    label: '团队名称',
    key: 'teamName'
  },
  {
    type: 'input',
    label: '团队负责人',
    key: 'teamHead'
  },
  {
    type: 'input',
    label: '联系电话',
    key: 'contactPhoneNumber',
    maxLength: 11
  },
  {
    type: 'input',
    label: '真实姓名',
    key: 'realName',
    rules: [
      { required: true, errorMessage: '请填写真实姓名' }
    ]
  },
  ...cardForm,
  {
    type: 'textarea',
    label: '团队简介',
    key: 'teamIntroduction',
    placeholder: '请简要描述一下您的团队，如知名宣推号、合作品牌案例等...'
  }
]

export const BRAND_FORM_CONFIG = [
  ...commonForm,
  {
    type: 'input',
    label: '公司名称',
    key: 'companyName'
  },
  {
    type: 'input',
    label: '默认负责人',
    key: 'defaultHead'
  },
  {
    type: 'input',
    label: '联系电话',
    key: 'contactPhoneNumber',
    maxLength: 11
  },
  {
    type: 'input',
    label: '社会信用代码',
    labelWidth: '240rpx',
    key: 'code',
    placeholder: '请填写公司的社会信用代码'
  },
  ...areaForm,
  {
    type: 'input',
    label: '详细地址',
    key: 'detail'
  },
  {
    type: 'textarea',
    label: '备注',
    key: 'notes',
    placeholder: '请填写简要描述您的需求，以便我们尽快与您取得联系...'
  }
]

export const ACCOUNT_FORM_CONFIG = [
  {
    type: 'input',
    label: '登录账号',
    key: 'userName',
    rules: [
      { required: true, errorMessage: '请填写登录账号' }
    ]
  },
  {
    type: 'input',
    label: '用户昵称',
    key: 'nickName',
    rules: [
      { required: true, errorMessage: '请填写用户昵称' }
    ]
  },
  {
    type: 'input',
    label: '设置密码',
    key: 'password',
    placeholder: '请填写密码',
    rules: [
      { required: true, errorMessage: '请填写密码' }
    ]
  },
  {
    type: 'input',
    label: '确认密码',
    key: 'identifyPassword',
    rules: [
      { required: true, errorMessage: '请填写确认密码' }
    ]
  },
  {
    type: 'input',
    label: '手机号',
    key: 'phonenumber',
    labelWidth: '130rpx',
    prefixSlot: true,
    prefixName: 'phonePrefix',
    suffixSlot: true,
    suffixName: 'phoneSuffix',
    maxLength: 11,
    rules: [
      { required: true, errorMessage: '请填写手机号' }
    ]
  },
  {
    type: 'input',
    label: '验证码',
    key: 'phoneCode',
    suffixSlot: true,
    suffixName: 'phoneCode',
    maxLength: 4,
    rules: [
      { required: true, errorMessage: '请填写验证码' }
    ]
  }
]